var R = require('ramda');

var Left = function (x) {
  this.__value = x
}

Left.of = function (x) {
  return new Left(x)
}

Left.prototype.map = function (f) {
  return this;
}

var Right = function (x) {
  this.__value = x;
}

Right.of = function (x) {
  return new Right(x);
}

Right.prototype.map = function (f) {
  return Right.of(f(this.__value))
}

console.dir(Left.of("rain").map(function (str) {
  return "b" + str;
}));

var either = R.curry(function (f, g, e) {
  switch(e.constructor) {
    case Left: return f(e.__value);
    case Right: return g(e.__value);
  }
})


